package dazuoye;

import java.util.*;
public class ScoreCatalog implements Iterable<ExamScore>{
    private ArrayList<ExamScore> examscores=new ArrayList<ExamScore>();
    public ScoreCatalog(){
    };
    public void addExamScore(ExamScore examscore){
        examscores.add(examscore);
    }
    public Iterator<ExamScore> iterator(){
       Iterator<ExamScore> a=examscores.iterator();
       return a;
    }
    public ExamScore getExamScore(String code){
        for(Iterator<ExamScore>a=this.examscores.iterator();a.hasNext();){
        	ExamScore examscore=a.next();
            if(examscore.getCode().equals(code)){
                return examscore;
            }
        }return null;

    }
    public int getNumberOfExamScores(){
        return examscores.size();
    }

}
